<template>
  <elm-page-tb>
    <template #top>
      <el-input placeholder="请查询输入内容" prefix-icon='el-icon-search' size="mini" style="width: 250px;"
                v-model="postData.col_4" clearable></el-input>
      <right>
        <el-button-group>
          <el-button icon="el-icon-search" size="mini" @click="v_getData()">查询</el-button>
          <elm-open-button url="/system/flow/one_road_flowsec_form_s" width="1000" height="90%" title="新增"
                           :data="{'page_type':'create','flow_code':flow_code,'model':null,'node_submit':node_submit}"
                           icon="el-icon-edit">新增
          </elm-open-button>
        </el-button-group>
      </right>
    </template>
    <elm-table url="/system/login/flow/FlowsecFormItem_GetData" :post-data="postData" :default-expand-all="true"
               height="100%">
      <el-table-column prop="sys_code_key" label="流程号" width="200px"  align="center"></el-table-column>
      <el-table-column prop="col_3" label="付款金额(元)" align="center"></el-table-column>
      <el-table-column prop="col_4" label="收款方" align="center"></el-table-column>
      <el-table-column prop="sys_createtime" label="提交时间" align="center">
        <template v-slot="scope">
          {{ elm.parseTime(scope.row.sys_createtime) }}
        </template>
      </el-table-column>
      <el-table-column fixed="right" label="操作" width="160px" align="center">
        <template v-slot="scope">
          <elm-open-button url="/system/flow/one_road_flowsec_form_s" width="1000" height="90%" title="编辑"
                           :data="{'page_type':'edit','flow_code':flow_code,'model':scope.row,'node_submit':node_submit}"
                           v-if="v_showSubmit(scope.row)" type="text">编辑
          </elm-open-button>
          <elm-open-button url="/system/flow/one_road_flowsec_form_s" width="1000" height="90%" title="信息"
                           :data="{'page_type':'show','flow_code':flow_code,'model':scope.row}"
                           type="text">查看
          </elm-open-button>
          <elm-flow-secformdata-delete-button :data_id="scope.row.id" :flow_code="flow_code"
                                              :after_del="v_getData">删除</elm-flow-secformdata-delete-button>
        </template>
      </el-table-column>
    </elm-table>
  </elm-page-tb>
</template>

<script>

export default {
  extends: elmVueBase,
  data() {
    return {
      loading: true,
      dataList: [],
      postData: {
        pageNum: 1, pageSize: 20, count: 0,
        flow_code: 'bms_payment',
      },
      flow_code: 'bms_payment',
      allowInitFlow: true,
      node_submit: ',提交,',
      needConsole: true,
    }
  },
  mounted() {
    this.v_getData();
  },
  methods: {
    async v_getData() {
      this.tablebinding();
    },
    v_showSubmit: function (data) {
      this.v_consoleData(data);
      if (this.em(data.nodeins_id)) {
        return this.allowInitFlow;
      } else if (data.nodeins_status != 'running' || data.preson_status != 'running') {
        return false;
      }
      let check = !this.em(data.nodeins_title) && this.node_submit.indexOf(',' + data.nodeins_title + ',') >= 0;
      return check;
    },
    v_consoleData: function (data) {
      if (this.needConsole) {
        console.log(JSON.stringify(data));
      }
    },
    em: function (s) {
      if (s == null || s == '') {
        return true;
      } else {
        return false;
      }
    },
  }
}
</script>
<style>
.one_road .elm-body {
  padding: 5px;
}
</style>